﻿



<div ng-controller="Customer_ComfirmListC">
    <div class="bg-light lter b-b wrapper-md">
        <h1 class="m-n font-thin h3">报备确认列表</h1>
    </div>
    <div class="wrapper-md" style="text-align: center;">
        <div class="panel panel-default">
            <div class="panel-heading">
                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-12 input-group">
                    <input type="text" class="form-control" id="findname" placeholder="按名称查找" ng-model="findname">
                    <span class="input-group-btn">
                        <button class="btn btn-default" type="button"  ng-click="find()">查找</button>
                    </span>
                </div>
            </div>
            <div class="table-responsive">
                <table id="example1" class="table table-striped b-t b-light table-bordered">
                    <thead>
                        <tr>
                            <th style="text-align: center;">名称</th>
                            <th style="text-align: center;">地区</th>
                            <th style="text-align: center;">地址</th>
                            <th style="text-align: center;">备注</th>
                            <th style="text-align: center;">信誉</th>
                            <th style="text-align: center;">管理人</th>
                            <th style="text-align: center;">操作</th>

                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat="item in pageData.Data">
                            <td style="width: 15%">{{item.ShortName}}</td>
                            <td style="width: 15%">{{item.District.FillName}}</td>
                            <td style="width: 10%">{{item.Address}}</td>
                            <td style="width: 10%">{{item.Remarks}}</td>
                            <td style="width: 10%">{{item.CreditScore}}</td>
                            <td style="width: 10%">{{item.ClientManager.Name}}</td>

                            <td style="width: 20%">

                                <button class="btn btn-sm btn-default" ng-click="openWindow(item)">
                                    <i class="fa fa-plus text"></i>
                                    <span class="text">处理</span>
                                </button>
                            </td>

                        </tr>
                    </tbody>
                </table>
                <div class="panel-heading" my-pagination get-page-data="getData" mypagedata="pageData"></div>
            </div>
        </div>
    </div>
</div>
<script>
    angular.module('app')//非标优惠
.controller("Customer_ComfirmListC", function ($scope, $state, $http,toSave) {
    $scope.pageData = {};
    $scope.pageData.Page = 0;

    $scope.pageData.Rows = $scope.defPageRows;
    //
    $scope.getData = function (p, r) {
        if (p) {
            p = p < 1 ? 1 : p;
        } else p = 1;
        if (r) {
        } else r = $scope.defPageRows;
        toSave.save_pages_lis(p,r);//保存当前页码和条数
        console.log(toSave.get_pages(),toSave.get_lis());
        $http({
            url: "/api/Customer/List",
            method: "GET",
            params: { state: 0, page: p, rows: r, like: $scope.findname }
        })
        .then(function (res) {
            $scope.pageData = res.data;
            console.log($scope.pageData);
        })
        .then(function (error) {
            if (error) {
                alert("数据获取失败");
            }
        });
    };
    // $scope.getData(toSave.get_pages(), $scope.pageData.Rows);
    $scope.find = function () {
        $scope.getData(1, $scope.pageData.Rows);
        toSave.save_inputs();//点击查询先保存input里面的值
        console.log(toSave.get_inputs('findname'));
    };
    ///////////////////////////////////////////////////////////////////
    if (toSave.get_inputs('findname')) {
                    console.log()
                    $scope.findname=toSave.get_inputs('findname');//把保存该id名的值取出来赋值给input框
                    // $scope.typename=localStorage.getItem("c");
                    // console.log($scope.typename);
                    $scope.getData(toSave.get_pages(), toSave.get_lis());
    }else{
                    $scope.getData(1, $scope.pageData.Rows);
    }
    $scope.openWindow = function (item) {
        var url = $state.href('app.Customer_Confirm', { 'id': item.Id,'from':1 });
        window.open(url, '_blank');
    }

})


</script>
<script src="js/services/toSave.js"></script>

